package com.baiqian.doupo.douji;

import com.baiqian.doupo.capability.douqi.IDouQiCapability;
import com.baiqian.doupo.tileentity.HuoDingTileEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;

public class DouJi_DouQiShuSong extends DouJi{
    public DouJi_DouQiShuSong(){
        super("斗气输送", 5,4,3,-1,1*20,
                0,0.0,0.0,0.0,2,4,false,false);
    }

    @Override
    public void useEx(IDouQiCapability l, PlayerEntity entity) {
        RayTraceResult ray_trace_result= entity.pick(4,0,false);
        TileEntity tile_entity =  entity.world.getTileEntity(new BlockPos(ray_trace_result.getHitVec()));
        if(tile_entity instanceof HuoDingTileEntity){
            ((HuoDingTileEntity) tile_entity).addTemperature(0.83333);//30s加完500°
        }
//        Direction direction = entity.getAdjustedHorizontalFacing();
//        BlockPos blockPos = new BlockPos(new Vector3d(entity.getPosX(),entity.getPosY(),entity.getPosZ()).add(new Vector3d(direction.getXOffset(),direction.getYOffset(),direction.getZOffset())));
//        if(entity.world.getBlockState(blockPos).matchesBlock(Blocks.AIR))
//            entity.world.setBlockState(blockPos,new BlockState(BlockRegistry.huo_ding.get(),null ,null));
    }

    @Override
    public void addEffect(LivingEntity entity) {

    }

    @Override
    protected void createEntity(IDouQiCapability l,PlayerEntity playerEntity) {}
}
